import com.miage.itrading.gui.BarreProgressionChargement;
import com.miage.itrading.gui.FenetrePrincipale;
import com.miage.itrading.serveur.Serveur;
import com.miage.itrading.utils.Const;
import com.miage.itrading.utils.Util;


public class Main {

	public static void main(String[] args) {

		if (Const.START_CLIENT) {
			
			class Wait extends Thread {
				private BarreProgressionChargement bpc;
				
				public Wait(BarreProgressionChargement bpc) {
					this.bpc = bpc;
				}
				
				public void run() {
					while (bpc.isAlive()) {
						try {
							Thread.sleep(200);
							
						} catch (InterruptedException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
					
					new FenetrePrincipale();
				}
			};
			
	       javax.swing.SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	            	BarreProgressionChargement bpc = new BarreProgressionChargement();
	            	bpc.start();
	            	
	            	Wait wait = new Wait(bpc);
	            	wait.start();
	            }
	        });
		}
		else {
			new Serveur();
		}
	}
}